﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace Yaaf.Wp7.AdvancedExplorer
{
    using System.Threading;

    using Microsoft.Xna.Framework.GamerServices;

    public class InputBoxHelper
    {
        public static string ShowInputBox(string title, string description, string defaultText)
        {
            bool done = false;
            string input = null;
            Guide.BeginShowKeyboardInput(
                Microsoft.Xna.Framework.PlayerIndex.One, 
                title, 
                description, 
                defaultText,
                new AsyncCallback( (res) =>
                    {
                        input = Guide.EndShowKeyboardInput(res);
                        done = true;
                    }),
                null);

            while (!done)
            {
                Thread.Sleep(300);
            }

            return input;
        }
    }
}
